🛡️ Sentinel: [MEDIUM] Fix PII exposure in audit logging - #211
Conversation
🚨 Severity: MEDIUM 💡 Vulnerability: The `approverId` in the `PolicyOverrideRequest` was being logged in plaintext when a blocked file extension was allowed. 🎯 Impact: System audit logs were capturing sensitive user identifiers without pseudonimization, violating PII rules. 🔧 Fix: Added `hashApproverId` method that checks for null values and uses SHA-256 to hash the `approverId` before logging it. Updated test cases to achieve 100% test coverage. ✅ Verification: `mvn test` passes successfully and jacoco coverage correctly ensures coverage of `hashApproverId`.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR addresses a medium-severity privacy issue in Clearfolio’s document validation/audit logging path by ensuring the PolicyOverrideRequest.approverId is no longer logged in plaintext when a blocked extension override is accepted.
Changes:
- Replaced audit logging of plaintext
approverIdwith a SHA-256 hash via a newhashApproverIdhelper. - Added unit tests to cover the new hashing behavior and the digest-unavailable failure path.
- Documented the incident/learning in
.jules/sentinel.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/java/com/clearfolio/viewer/service/DefaultDocumentValidationService.java | Hashes approverId before logging during blocked-extension override acceptance. |
| src/test/java/com/clearfolio/viewer/service/DefaultDocumentValidationServiceTest.java | Adds tests for hashApproverId behavior and failure mode coverage. |
| .jules/sentinel.md | Records the PII-in-logs issue and prevention guidance for future Sentinel learnings. |
Comments suppressed due to low confidence (2)
src/main/java/com/clearfolio/viewer/service/DefaultDocumentValidationService.java:215
hashApproverIdreturns the literal string "null" for a null input, which mixes a sentinel value into a method that otherwise returns a hex digest. Returningnullkeeps the method contract consistent and avoids downstream consumers treating the result as a valid hash string.
private String hashApproverId(String approverId) {
if (approverId == null) {
return "null";
}
src/test/java/com/clearfolio/viewer/service/DefaultDocumentValidationServiceTest.java:549
- This test removes all JVM security providers to force
MessageDigest.getInstance("SHA-256")to fail. Since this is global JVM state, the pattern is brittle and duplicated with the similar provider-removal logic inthrowsWhenSha256DigestIsUnavailableForOverrideAuditFingerprint()below; consider extracting a shared helper that temporarily clears/restores providers to reduce duplication and make the restoration logic harder to get wrong.
synchronized (SECURITY_PROVIDERS_LOCK) {
Provider[] providers = Security.getProviders();
for (Provider provider : providers) {
Security.removeProvider(provider.getName());
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| LOGGER.info( | ||
| "Blocked-format override accepted extension={} approverId={} tokenFingerprint={}", | ||
| sanitizeForLog(extension), | ||
| sanitizeForLog(overrideApproverIdForAudit), | ||
| hashApproverId(overrideApproverIdForAudit), | ||
| tokenFingerprint(overrideTokenForAudit) | ||
| ); |
| @Test | ||
| void hashApproverIdReturnsNullStringWhenInputIsNull() throws Exception { | ||
| ConversionProperties conversionProperties = new ConversionProperties(); | ||
| DefaultDocumentValidationService validationService = new DefaultDocumentValidationService(conversionProperties); | ||
| Method method = DefaultDocumentValidationService.class.getDeclaredMethod("hashApproverId", String.class); | ||
| method.setAccessible(true); | ||
| String hashed = (String) method.invoke(validationService, (String) null); | ||
| assertEquals("null", hashed); | ||
| } |
|
|
||
| ## 2026-07-26 - [PII exposure in audit logging] | ||
| **Vulnerability:** The `approverId` in the `PolicyOverrideRequest` was being logged in plaintext when a blocked file extension was allowed. | ||
| **Learning:** System audit logs were capturing sensitive user identifiers without pseudonimization, violating PII rules. |
Superseded by #165.